package com.qf.fmall2203.index.controller;

import com.qf.fmall2203.index.service.ProductService;
import com.qf.fmall2203.index.service.impl.ProductServiceImpl;
import com.qf.fmall2203.vo.ResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import sun.rmi.runtime.Log;

@RestController
@RequestMapping("/product")
@CrossOrigin
@Slf4j
public class ProductController {

    @Autowired
    ProductService productService;

    @GetMapping("/detail-info/{id}")
    public ResultVo detailInfo(@PathVariable("id") Integer id){

      return   productService.getDetailInfo(id);

    }

    @GetMapping("/detail-commonts/{id}")
    public ResultVo detailCommonts(@PathVariable("id") Integer id,Integer pageNum,Integer limit){
        log.debug("id收参为:{},pageNum收参为:{},limit收参为:{}",id,pageNum,limit);

        return   productService.detailCommonts(id,pageNum,limit);

    }

    @GetMapping("/detail-commontscount/{id}")
      public ResultVo detailCommontscount(@PathVariable("id") Integer id){



        return productService.detailCommontscount(id);
    }
    @GetMapping("/detail-params/{id}")
    public ResultVo detailParams(@PathVariable("id") Integer id){



        return productService.detailParams(id);
    }

}
